home *** CD-ROM | disk | FTP | other *** search
/ Java Certification Exam Guide / McGrawwHill-JavaCertificationExamGuide.iso / pc / Web Links and Code / code / chap3 / Queue.java < prev   
Encoding:
Text File  |  1997-04-19  |  402 b   |  25 lines

  1. class Queue extends Vector {   
  2.  
  3.    Queue() {
  4.       super();
  5.    }
  6.  
  7.    Queue(int capacity) {
  8.       super(capacity);
  9.    }
  10.  
  11.    Queue(int capacity, int increment) {
  12.       super(capacity, increment);
  13.    }
  14.  
  15.    void add(Object obj) {
  16.       addElement(obj);
  17.    }
  18.  
  19.    Object get() { 
  20.       Object obj = lastElement();
  21.       boolean success = removeElement(obj);
  22.       return obj;
  23.    }
  24. }
  25.